package com.daon.controller;

import com.daon.service.ILogService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author 1daon
 * @EMAIL 532418116@qq.com
 * @Version 创建时间：2019/2/24 8:18 PM
 * @Modified By
 */
@Controller
@RequestMapping("/sys/sysLog")
public class SysLogController {

    @Autowired
    private ILogService iLogService;

    @RequestMapping("operate.page")
    public ModelAndView operateLog(@RequestParam(value = "search", defaultValue = "") String search,
    @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
    @RequestParam(value = "pageSize",defaultValue = "10") int pageSize){
        ModelAndView mav = new ModelAndView("/backend/sysLog/operate");
        PageInfo operateList = iLogService.getSysOperateLogList(pageNum,pageSize,search);
        mav.getModel().put("search", search);
        mav.getModel().put("operateList", operateList);
        return mav;
    }
    @RequestMapping("sysLog.page")
    public ModelAndView sysLog(@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                               @RequestParam(value = "pageSize",defaultValue = "10") int pageSize){
        ModelAndView mav = new ModelAndView("/backend/sysLog/sysLog");
        PageInfo sysLogList = iLogService.getSysLogList(pageNum,pageSize);
        mav.getModel().put("sysLogList", sysLogList);
        return mav;
    }
}
